package com.example.hangzhou.welbeing.mytestdemoapp.animation.animationActivity;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.design.widget.TabLayout;
import android.support.v4.view.ViewPager;
import android.support.v7.app.AppCompatActivity;
import android.view.KeyEvent;

import com.example.hangzhou.welbeing.mytestdemoapp.R;
import com.example.hangzhou.welbeing.mytestdemoapp.animation.animationAdapter.TransitionNoteAdapter;

import butterknife.Bind;
import butterknife.ButterKnife;

/**
 * 杭州惟君医疗科技有限公司09
 * Created by 20433 on 2018/5/9
 *
 * @desc 东风 山河绿，春已 不折柳，繁花 看不尽，处处 惹人留
 * @desc 佛祖镇楼，bug 辟容易
 */

public class TransitionNoteActivity extends AppCompatActivity {
    @Bind(R.id.activity_translate_note_tb)
    TabLayout activityTranslateNoteTb;
    @Bind(R.id.activity_translate_note_viewpager)
    ViewPager activityTranslateNoteViewpager;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_translate_note);
        ButterKnife.bind(this);
        TransitionNoteAdapter transitionNoteAdapter =  new TransitionNoteAdapter(getSupportFragmentManager());
        // 给ViewPager设置适配器
        activityTranslateNoteViewpager.setAdapter(transitionNoteAdapter);
        // 使用 TabLayout 和 ViewPager 相关联
        activityTranslateNoteTb.setupWithViewPager(activityTranslateNoteViewpager);
    }

    @Override
    public boolean onKeyDown(int keyCode, KeyEvent event) {
        if (keyCode == KeyEvent.KEYCODE_BACK) {

            finish();
            overridePendingTransition(R.anim.slide_left_in, R.anim.slide_right_out);
        }

        return super.onKeyDown(keyCode, event);//继续执行父类其他点击事件
    }
}
